/****************************************************************************/
/****************************************************************************/
/*                                                                          */
/* This file contains the interface functions                               */
/* you should use for the wet ex 2                                                                       */ 
/*                                                                          */ 
/****************************************************************************/
/****************************************************************************/

/****************************************************************************/
/*                                                                          */ 
/* File Name : library2.h                                                   */ 
/*                                                                          */ 
/****************************************************************************/

#ifndef _234218_WET2_07_08 
#define _234218_WET2_07_08


#ifdef __cplusplus
extern "C" {
#endif


// return values
enum StatusType  {
	SUCCESS = 0,
	FAILURE = -1,
	ATTACK_FAILED = -2};


// required interface to data structure
// ------------------------------------

// initialize data structure
// input: none
// return: NULL in case of allocation error or if n<=0 or defaultSalary <=0
//		   SUCCESS otherwise
void* init(int n, int defaultSalary);

// town1 attacks town2
// input: DS - the data structure
// return: FAILURE - in case of parameter error or if either town no longer exists
//		   ATTACK_FAILED - in case of failed attack
//		   SUCCESS - otherwise
StatusType attack(void* DS, int town1, int town2);

// get citizen's town
// input: DS - the data structure
//		  id - citizen's id
// output: townid - the citizen's current town
// return: FAILURE - in case of any problem
//		   SUCCESS - otherwise
StatusType getTown(void* DS, int id, int* townId); 

// get pope tax for town
// input: DS - the data structure
//		  town - the town queried
// output: tax - the tax level of the twon
// return: FAILURE - in case of any problem
//		   SUCCESS - otherwise
StatusType getPopeTax(void* DS, int town, int* tax);

// change pope tax for a range of towns
// input: DS - the data structure
//		  townFrom - lower limit of townrange
//		  townTo - upper limit of town range
//		  additionalTax - the offset to be applied to the tax of all towns
// return: FAILURE - in case of any problem
//		   SUCCESS - otherwise
StatusType changePopeTax(void* DS, int townFrom, int townTo, int additionalTax);

// change a town's salary
// input: DS - the data structure
//		  town - the town being changed
//		  newSalary - the new salary
// return: FAILURE - in case of any problem
//		   SUCCESS - otherwise
StatusType changeSalary(void* DS, int town, int newSalary);

// quit
// input: DS - the data structure
void quit(void* DS);


#ifdef __cplusplus
}
#endif

#endif    /*_234218_WET2_07_08 */ 
